

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>积分订单</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <#include "../../include/layui.ftl" />
    <#include "../../include/pTable.ftl" />
</head>
<body>

<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-form layui-card-header layuiadmin-card-header-auto">
            <form  id="queryForm">
                <input type="hidden" id="className" name="className" value="${className!}" />
                <input type="hidden" id="modleName" name="modleName" value="${modleName!}" />
                <input type="hidden"  name="createrId" value="${SESSION_USER.user.id!}" />
                <input type="hidden" name="createrId_searchType" value="eq">
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">商户订单号</label>
                        <div class="layui-input-block">
                            <input type="text" name="orderNumber" placeholder="请输入" autocomplete="off" class="layui-input">
                            <input type="hidden" name="orderNumber_searchType" value="like">
                        </div>
                    </div>
                </div>
            </form>
            </form>
        </div>

        <div class="layui-card-body">

            <table id="lay-table" lay-filter="lay-table"></table>
            <script type="text/html" id="toolbar">
            </script>
        </div>

        <div class="layui-hide">
            <table  id="lay-excal-table" lay-filter="lay-excal-table"></table>
        </div>

    </div>
</div>

<script>
    layui.config({
        base: '${path}/plug-in/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index','tables','layers','view','excels'],function () {
        var tables = layui.tables,
            table = layui.table,
            view = layui.view,
            layer = layui.layer,
            layers = layui.layers,
            excels = layui.excels,
            $ = layui.$;

        var parmer = {
            url:'/console/integral/order/list',
            defaultToolbar: ['filter',{
                title: '导出' //标题
                ,layEvent: 'LAYTABLE_TIPS' //事件名，用于 toolbar 事件中使用
                ,icon: 'layui-icon-export' //图标类名
            }],
            where:{sort : 'create_time',order:'desc',createrId:"${SESSION_USER.user.id!}",createrId_searchType:"eq" },
            cols:[[
                {field:"orderNumber",width:170,title:"商户订单号"}
                ,{field:"integral",width:130,title:"订单积分"}
                ,{field:"state",width:120,title:"订单状态",templet:function(d){
                        var val = "";
                        if (d.state == 0) val = "<span style='color:green;'>已发货</span>";
                        if (d.state == 1) val = "<span style='color:red;'>待发货</span>";
                        return val;
                    }}
                ,{field:"type",width:120,title:"订单类型"}
                ,{field:"trackingNo",width:120,title:"物流单号"}
                ,{field:"productName",width:120,title:"产品名称"}
                ,{field:"remarks",width:120,title:"备注"}
                ,{field:"auditor",width:120,title:"审核人员"}
                ,{field:"createTime",width:180,title:"下单时间"}
                /*  ,{field:"resultCode",width:'8%',title:"支付结果",templet:function (d) {
                      var val = "<span style='color:orange;'>支付中</span>";
                      if (d.resultCode == 'SUCCESS') val = "<span style='color:green;'>成功</span>";
                      if (d.resultCode == 'FAIL') val = "<span style='color:red;'>失败</span>";
                      return val;
                  }}*/
            ]]
        };
        var $tables = tables.renderTable(parmer);

        var excel_parmer = {};
        excel_parmer = $.extend({}, excel_parmer, parmer);
        excel_parmer.id = "lay-excal-table";
        excel_parmer.elem = "#lay-excal-table";
        excel_parmer.where.noPage = true;
        excel_parmer.page = false;
        var $excelTables = tables.renderTable(excel_parmer);

        //头工具栏事件
        table.on('toolbar(lay-table)', function(obj){
            switch(obj.event){
                case '01':
                    layers.add({
                        // content:"/console/integral/order/add",
                        area:['700px', '600px']
                    });
                    break;
                case '02':
                    layers.edit({
                        title: '发货',
                        area:['700px', '500px'],
                        data: p.data
                    });
                    break;
                case '03':
                    layers.delete({url:'/console/com.fs.common.pojo.IntegralOrder/delete',data:p.data});
                    break;
                case '04':
                    layers.view({
                        area:['700px', '760px'],
                        data: p.data
                    });
                    break;
                case '05':
                    var where = $("#queryForm").serializeObject();
                    where = $.extend({}, $tables.config.where, where);
                    $tables.reload({
                        where: where,
                        text: {none: '暂无数据！'}
                    });
                    break;
            };
        });

    });
</script>
</body>
</html>